//
//  CameraOperationInterface.h
//  BaiXiaoEr
//
//  Created by jinbo on 2021/1/6.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "CameraManagerConst.h"
#import "CameraPropertiesCache.h"
#import "CMImageFilter.h"
#import "CMFileNode.h"

@class CMFileNode, CMResolution, CMRecordHandle, CMDeviceInfo;
/// 设备操作接口 拍照/录制/设置参数等
@protocol CameraOperationInterface <NSObject>

@optional

#pragma mark - 相机图片操作
/// 图片过滤器
//@property (nonatomic, strong) CMImageFilter *imageFilter;

#pragma mark - 属性插件工具操作接口
/// 设备连接状态
- (CMConnectStatus)status;

/// 设备连接方式
- (CMConnectType)deviceConnectType;

/// 当前camera type
- (int)cameraType;//1-i4,2-lexin

/// 当前图片帧
- (UIImage *)currentImage;

/// 最后一次拍照录制的缩略图
- (UIImage *)lastRecordImage;

#pragma mark - 设备操作
@property (nonatomic, assign) BOOL gyroscopeSwitch;

@property (nonatomic, assign) BOOL ignoreSleepCamera;

/// 获取设备信息
/// - Parameters:
- (void)getDeviceInfoWithCompletion:(void(^)(CMDeviceInfo *info))completion;

/// 设置灯光亮度
/// 0-100
- (void)setPwm:(int)pwm DEPRECATED_MSG_ATTRIBUTE("use -setLEDMode:light:");

/// 设置灯光开关亮度模式
- (void)setLEDMode:(CameraLightMode)mode light:(NSInteger)light completion:(ProcessBoolBlock)completion;

/// 设置灯光开关亮度模式(盛世传媒 index=1 固定参数)
- (void)setLEDMode:(CameraLightMode)mode light:(NSInteger)light index:(NSInteger)index completion:(ProcessBoolBlock)completion;

/// 获取灯光
- (void)getLEDLightWithCompletion:(ProcessIntBlock)completion;

/// 补光灯模式
- (void)setLEDFillMode:(NSInteger)mode completion:(ProcessBoolBlock)completion;

/// 获取补光灯模式
- (void)getLEDFillModeWithCompletion:(ProcessIntBlock)completion;

/// 设置黑头仪模式
/// @param mode   -1 自增   0：正常模式（护理模式）1：厂测模式 2：黑头查看模式 3:蓝光杀菌
- (BOOL)setBlackHeadMode:(int)mode;

/// 切换对应吸嘴效果
- (void)changeNozzleModeWithCmdID:(int) cmdID
                            value:(int) value
                       completion:(ProcessBoolBlock)completion;;

/// 设备属性信息
- (CameraPropertiesCache *)propertiesCache;

/// 烧录License
- (void)brunLicenseWithData:(NSData *)licData completion:(ProcessBoolBlock)completion;

/// 开启去抖
- (void)openDebounce:(BOOL)flag;

/// 设置分辨率
- (BOOL)setResolution:(CMResolution *)resolution;

/// 设置分辨率
- (BOOL)setResolutionIndex:(NSInteger)index;

/// 设置下一个分辨率
- (BOOL)setNextResolution;

#pragma mark - 功能参数
/// 固件支持的颜色效果
- (BOOL)supportColorEffect;
/// 固件支持的颜色效果
- (void)setColorEffect:(CameraImageColorEffect)colorEffect completion:(ProcessBoolBlock)completion;
/// 固件支持的颜色效果
//- (CameraImageColorEffect)colorEffect;
- (void)colorEffectWithCompletion:(ProcessIntBlock)completion;

/// 支持模式切换
- (BOOL)supportSwitchMode;
/// 设置模式
- (void)setCameraMode:(CameraMode)mode completion:(ProcessBoolBlock)completion;
/// 当前模式
- (void)cameraModeWithCompletion:(ProcessIntBlock)completion;

/// 是否支持马达
- (BOOL)supportMotor;
/// 马达开关
- (void)setMotorSwitch:(BOOL)motor completion:(ProcessBoolBlock)completion;
/// 马达开关
- (void)motorSwitchWithCompletion:(ProcessBoolBlock)completion;;
/// 马达值
- (void)setMotorValue:(NSInteger)motorValue completion:(ProcessBoolBlock)completion;
- (void)setMotorValue:(NSInteger)motorValue action:(CMMotorAction)action completion:(ProcessBoolBlock)completion;
/// 马达值
- (void)motorValueWithCompletion:(ProcessIntBlock)completion;

/// 是否支持图片亮度, 固件支持
- (BOOL)isSupportImageLight;
/// 设置图片亮度
- (void)setImageLight:(NSInteger)light completion:(ProcessBoolBlock)completion;
/// 获取图片亮度
- (void)imageLightWithCompletion:(ProcessIntBlock)completion;

/// 是否支持切分辨率
- (BOOL)isSupportResolution;

/// 是否禁用电量
- (BOOL)disableBattery;

/// 是否支持灯光调节
- (BOOL)isSupportLED;

/// 是否支持陀螺仪
@property (nonatomic, assign, readonly) BOOL isSupportGyroscope;

/// 是否支持切换镜头
- (BOOL)isSupportSwitchLen;

/// 开启过滤 ,BK支持
- (void)openFilterErrorData:(BOOL)open;

/// 抢占冲突的设备
- (void)preemptiveConflictedDevice;

/// 同步录制状态 0不在录制，1在录制
- (void)cameraRecordStatusSync:(int) status;

/// 去抖
- (void)cameraChangeAngleDiff:(int) diff;

#pragma mark - 固件升级
/// 固件版本检查
/// - Parameter completion: 当前版本
- (void)checkFirmwareUpgradeWithCompletion:(void(^)(NSString *version))completion;

/// 开始固件升级
/// - Parameters:
///   - firmwarePath: 升级文件路径
///   - progress: 进度
///   - completion: 完成
- (void)startFirmwareUpgradeWithDataPath:(NSString *)firmwarePath progress:(void(^)(float progress))progress completion:(void(^)(BOOL success))completion;

#pragma mark - 文件操作
- (NSArray<CMFileNode *> *)acceptFilesForPath:(NSString *)path beginIndex:(NSInteger)begin count:(NSInteger)count;

#pragma mark - Deprecated
///// 视频录制工具recordStatus
//@property (nonatomic, strong) CMRecordHandle *recordHandle DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");
///// 录制状态
//- (/*CMRecordStatus*/NSInteger)recordStatus DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share.recordStatus");
//
///// 拍照
///// @param completion 返回 本地路径或相簿中的ID
//- (void)takePhotoWithCompletion:(ProcessSavePhotoBlock)completion DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");
////
/////// 拍照
/////// @param completion 返回 本地路径或相簿中的ID
//- (void)takePhotoWithImage:(UIImage *)image completion:(ProcessSavePhotoBlock)completion DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");
////
////
/////// 开始录制
/////// @param completion 开始是否成功
/////// @param recordTimerBlock 录制时间
/////// @param recordErrorBlock 录制出错
//- (void)startRecordingWithCompletion:(ProcessBoolBlock)completion
//                    recordTimerBlock:(ProcessIntBlock)recordTimerBlock
//                    recordErrorBlock:(ProcessVoidBlock)recordErrorBlock DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");
////
/////// 停止录制
/////// @param completion 返回 本地路径或相簿中的ID
//- (void)stopRecordingWithCompletion:(ProcessSavePhotoBlock)completion DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");

/// MFI 设备是否已插入
- (BOOL)mfiDeviceIsInsert;

// Mfi手动OpenSession
- (void)manuallyMfiOpenSession;

// Mfi手动CloseSession
- (void)manuallyMfiCloseSession;

@end
